package com.bigcreate.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Books {

    private int id;
    private String bookName;
    private String author;
    private String publisher;
    private int quantity;
    private int price;
    private String isbn;
    private String description;

    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format="yyyy-MM-dd")
    private Date publishTime;

    // id不用输入，数据库自动添加
    public Books(String bookName, String author, String publisher, int quantity, int price, String isbn, String description, Date publishTime) {
        this.bookName = bookName;
        this.author = author;
        this.publisher = publisher;
        this.quantity = quantity;
        this.price = price;
        this.isbn = isbn;
        this.description = description;
        this.publishTime = publishTime;
    }
}
